package com.hao.nettytest.Component;

import com.corundumstudio.socketio.SocketIOServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

//SpringBoot启动之后执行
@Component
public class SocketServer implements CommandLineRunner {

    //socketIOServer
    private final SocketIOServer socketIOServer;

    @Autowired
    public SocketServer(SocketIOServer socketIOServer) {
        this.socketIOServer = socketIOServer;
    }

    @Override
    public void run(String... args) {
        socketIOServer.start();
        System.out.println("=============== NettySocket服务启动成功 ===============");
    }

}

